
<template>
  <div class="commo">
    <el-table :data="commodity" stripe style="width: 100%">
      <el-table-column label="评分" width="100">
        <template slot-scope="scope">
          <span style="margin-left: 0px">{{ scope.row.descScore }}</span>
        </template>
      </el-table-column>
      <el-table-column label="商品名称" width="250">
        <template slot-scope="scope">
          <span style="margin-left: 0px">{{ scope.row.dtitle }}</span>
        </template>
      </el-table-column>
      <el-table-column label="活动" width="330">
        <template slot-scope="scope">
          <span style="margin-left: 0px">{{ scope.row.title }}</span>
        </template>
      </el-table-column>
      <el-table-column label="单价" width="150">
        <template slot-scope="scope">
          <span style="margin-left: 0px">{{ scope.row.actualPrice }}</span>
        </template>
      </el-table-column>
      <el-table-column label="图片" width="150">
        <template slot-scope="scope">
          <div style="margin-left: 0px" class="commdityimg">
            <img :src="scope.row.mainPic" alt="">
          </div>
        </template>
      </el-table-column>
      <el-table-column label="官方地址" width="200">
        <template slot-scope="scope">
          <span style="margin-left: 0px">{{ scope.row.shopName }}</span>
        </template>
      </el-table-column>
    </el-table>
    <sorter></sorter>
  </div>
</template>

<script>
/* eslint-disable*/
import { axiosApi } from '../../src/axios/api.js'
import bus from '../../store/bus'
import sorter from '../../src/components/sorter.vue'
export default {
  data() {
    return {
      // 数据源
      commodity: [
      ],
      //展示的数据源
      // commshowdata: [],
    }
  },
  //计算属性
  computed: {
  },
  //监听
  watch: {

  },
  //方法
  methods: {

  },
  //组件
  components: {
    sorter,
  },
  // 生命周期
  mounted() {
   
  },
  created() {
     // 接受axios传送的值
     axiosApi.get1().then((val) => {
      this.commodity = val.list
      // 把数据源传给分页器
      console.log('1s',this.commodity);
      bus.$emit('commditylist', this.commodity)
    })
    //接受展示的数据
    bus.$on('userlist', (val) => {
      this.commodity = val
    })
  },
}
</script>

<style lang="less" scoped>
.commo {
  margin-top: 30px;

  .commdityimg {
    width: 100px;
    height: 100px;
  }

  .commdityimg>img {
    width: 100%;
    height: 100%;
  }
}
</style>